import validate from 'wechat-validate'
Page({
  data:{
  account:'hdsj001',
  password:'123456'
  },
  behaviors: [validate],
 rules:{
  account:[
  {required:true,message:'请输入账号'}
],
password:[
  {required:true,message:'请输入密码'}
]
  },
 async submitForm(){
//表单校验
if(!this.validate()) return
//发请求登录
const res = await wx.$http.post('/driver/login/account',{account:this.data.account,password:this.data.password})
// console.log(res);
//保存token到本地
const app = getApp()
app.setToken('token',res)
//跳转页面
wx.switchTab({
  url: '/pages/user/user'
})
  }
})